import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    token: '',
  }),
  // 使用该插件，开启数据缓存
  persist: {
    enabled: true,
    strategies: [
      { storage: sessionStorage, paths: [] }, // sessionStorage存储
      { storage: localStorage, paths: ['token'] }, // accessToken字段用 localstorage存储
    ],
  },
})
